package com.kalvin.kvf.modules.dy.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kalvin.kvf.common.utils.ShiroKit;
import com.kalvin.kvf.modules.sys.entity.User;
import org.springframework.stereotype.Service;
import com.kalvin.kvf.modules.dy.entity.Task;
import com.kalvin.kvf.modules.dy.mapper.TaskMapper;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 * @since 2023-10-28 16:55:28
 */
@Service
public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements TaskService {

    @Override
    public Page<Task> listTaskPage(Task task) {
        User user = ShiroKit.getUser();
        if(!user.getUsername().equals("admin")){
            task.setPhone(user.getPhone());
        }
        Page<Task> page = new Page<>(task.getCurrent(), task.getSize());
        List<Task> tasks = baseMapper.selectTaskList(task, page);
        return page.setRecords(tasks);
    }


}
